<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
<head>
<jsp:include page="../inc_bootstrap.jsp"></jsp:include>
	<jsp:include page="../head.jsp"/>
<script type="text/javascript"> 

	$(function() {
		//先销毁表格
		$('#reportTable').bootstrapTable({
			url: "${ctx}/log/bootGrid",
			dataType: "json",
			method: 'get',
			cache: false,
			height: "auto",//
			striped: true,
			pagination: true,
			pageSize: 5,
			pageNumber:1,
			pageList: [10, 20, 50, 100, 200, 500],
			search: true,
			showColumns: true,
			showRefresh: true,
			clickToSelect: true,
			idField:'id',
			toolbar: "#toolbar",
			paginationHAlign: 'left',
			paginationDetailHAlign: 'right',
			sidePagination: "server", //表示服务端请求
			queryParamsType : "undefined",
			columns: [{field:"chk",checkbox:true},
				      {field:"id",title:"email",align:"left",valign:"middle",sortable:"true",visible:false},
			          {field:"username",title:"email",align:"left",valign:"middle",sortable:"true"},
			          {field:"ip",title:"company",align:"left",valign:"middle",sortable:"true"},
			          {field:"params",title:"date",align:"left",valign:"middle",sortable:"true"},
			          {field:"descriptions",title:"lastlogintime",align:"center",valign:"middle",sortable:"true"},
			          {field:"module",title:"version",align:"center",valign:"middle",sortable:"true"},
			          {field:"createtime",title:"isv2",align:"center",valign:"middle",sortable:"true"}
			         ],
			onPageChange: function (size, number) {
				//$("#pageSizeInput").val(size);
				//$("#pageNumberInput").val(number);
				//var form = $('#tableForm');
				//form.action= '${base}/showReport';
				//form.submit();
            },
			onSort: function (name, order) {
            },
// 			formatShowingRows: function (pageFrom, pageTo, totalRows) {
// 				return '';
//             },
// 			formatRecordsPerPage: function () {
// 				return '';
//             },
            formatNoMatches: function(){
            	return '无符合条件的记录';
            }
		});
		$(window).resize(function () {
			$('#reportTable').bootstrapTable('resetView');
		});
	}); 
	function getSelect(){
		var rows = getIdSelections();
		alert(rows);
		window.location.href='${ctx}/log/view?id='+rows;
	}
	function getIdSelections() {
        return $.map($('#reportTable').bootstrapTable('getSelections'), function(row) {
            return row.id
        });
    }
</script>
</head>
<body >
	<div id="content">
			<div id="content-body">
			<div id="reportTableDiv" class="span10">
				<table id="reportTable">
				</table>
			</div>
		</div>
	</div>
	<div id="toolbar">
		<input type="button" value="測試哦" onclick='getSelect()'/>
	</div>
<jsp:include page="../footer.jsp"/>
</body>
</html>